<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            max-width: 400px;
            margin: 100px auto;
            padding: 20px;
            background-color: #f5f7fa;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }
        h2 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #3498db;
        }
        form {
            display: flex;
            flex-direction: column;
        }
        div {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #333;
        }
        input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 16px;
        }
        input:focus {
            outline: none;
            border-color: #3498db;
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
        }
        .button-group {
            display: flex;
            flex-direction: column; /* 垂直排列按钮 */
            gap: 15px; /* 按钮间距 */
        }
        button {
            width: 100%; /* 按钮宽度100% */
            background-color: #3498db;
            color: white;
            border: none;
            padding: 14px;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #2980b9;
        }
        .register-btn {
            background-color: #2ecc71; /* 注册按钮绿色样式 */
        }
        .register-btn:hover {
            background-color: #27ae60;
        }
    </style>
</head>
<body>
<h2>登录</h2>

<form action="/login" method="post">
    <div>
        <label>用户名：</label>
        <input type="text" name="username" required />
    </div>
    <div>
        <label>密码：</label>
        <input type="password" name="password" required />
    </div>
    <div class="button-group">
        <button type="submit">登录</button>
        <a href="/register">
            <button class="register-btn" type="button">注册</button>
        </a>
    </div>
</form>
<p class="error-message" th:if="${error}" th:text="${error}">登录失败</p>

</body>
</html>